package com.example.localbites;

import java.util.List;

import com.example.constants.StringConstant;
import com.google.android.maps.GeoPoint;
import com.google.android.maps.MapActivity;
import com.google.android.maps.MapController;
import com.google.android.maps.MapView;
import com.google.android.maps.Overlay;
import com.google.android.maps.OverlayItem;

import android.os.Bundle;
import android.app.Activity;
import android.graphics.drawable.Drawable;
import android.view.Menu;

public class Display_Map extends MapActivity {

	MapController mControl;
	GeoPoint GeoP;
	MapView mapV;
	StringConstant con = new StringConstant();
	
	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.map_activity);
		
		
		
		Drawable drawable = this.getResources().getDrawable(R.drawable.map_pointer);
		LocalBitesItemizedOverlay itemizedoverlay = new LocalBitesItemizedOverlay(drawable, this);
		
		mapV = (MapView) findViewById(R.id.mapView);
		mapV.displayZoomControls(true);
		mapV.setBuiltInZoomControls(true);
		
		double lat = getIntent().getDoubleExtra(con.LATITUDE,0.0);
		double lng = getIntent().getDoubleExtra(con.LONGITUDE, 0.0);
		
		GeoP = new GeoPoint((int)(lat*1E6), (int)(lng*1E6));
		List<Overlay> mapOverlays = mapV.getOverlays();
		
		OverlayItem overlayitem = new OverlayItem(GeoP, "", "You are Here!");
		itemizedoverlay.addOverlay(overlayitem);
		mapOverlays.add(itemizedoverlay);
		mControl = mapV.getController();
		mControl.animateTo(GeoP);
		//oi.setMarker(oi.getMarker(R.drawable.map_pointer));
		mControl.setZoom(18);
			
	}

	@Override
	public boolean onCreateOptionsMenu(Menu menu) {
		// Inflate the menu; this adds items to the action bar if it is present.
		getMenuInflater().inflate(R.menu.display__map, menu);
		return true;
		
		
	}

	@Override
	protected boolean isRouteDisplayed() {
		// TODO Auto-generated method stub
		return false;
	}

}
